<?php
/*
 * Copyright (C) 2006 Google Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
/**
 * created Sep 3, 2007
 *
 * @author pablif@gmail.com
 */

include_once('../demo/gb-do-authentication.php');
require_once('../library/gb-items.php');
require_once('../library/gb-feeds.php');
require_once('../library/gb-http.php');

?>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<?php
  $gbhttp = new GoogleBaseHttpRequest('http://192.168.128.150:3128');
  $feed = new GoogleBaseFeed($gbhttp);
  $query = new GoogleBaseQuery(GBASE_SNIPPET_FEED_URL);
  $query->setBq('(iphone | ipod) -accessory -accessories');
  $query->setMaxResults(3);
  $query->setStartIndex(15);
  echo $query->getQueryUrl();
  $response = $feed->querySnippetsFeed($query);
  echo '<br>returned<br><xmp>';
  echo 'status code '.$response->getStatusCode()."\n";
  if(!$response->hasErrors()) {
    foreach($feed->getEntries() as $entry) {
      var_dump($entry);
    }
  }
  echo '</xmp>';
  $gbhttp->close();
?>
</html>

